vcUnitGroup
Unit group represents a group of units that apply to the same quantity and belong to the same unit family, thereby allowing you to create and delete unit objects.
See in: Overview
Module: vcCore
Parent: vcObject
Children -
Referenced by: vcQuantity.AvailableGroups, vcQuantity.CurrentGroup, vcQuantity.EffectiveGroup, vcUnitFamily.Groups, ... (see more)
vcQuantity.AvailableGroups
vcQuantity.CurrentGroup
vcQuantity.EffectiveGroup
vcUnitFamily.Groups
vcUnitManager.UnitGroups
vcUnitManager.createUnitGroup()
vcUnitManager.findUnitGroup()
Properties
Learn how to use properties here. The properties are also inherited from the parent class.
| Name | Type | Access | Description |
| IsBuiltIn | Boolean | R | Gets a value which defines if the unit group is a built-in group. |
| Name | String | RW | Gets or sets unit group name. Exceptions: ValueError: When given name is empty or not unique. |
| Quantity | vcQuantity | RW | Gets the quantity referencing unit group. |
| Units | vcList[vcUnit] | R | Gets a list of all units in unit group. See Unit strings |
Methods
Learn how to use methods here. The methods are also inherited from the parent class.
| Name | Return Type | Parameters | Description |
| createUnit | vcUnit | String name, String suffix | Adds a new unit of a given name and suffix to unit group.See moreParameters: name (String): Unit's name. suffix (String): Unit's suffix. Exceptions: ValueError: When current unit group is built-in. ValueError: When both name and suffix are not unique or either of them is empty. Returns: vcUnit: The newly created unit. |
| delete | None | None | Deletes the unit group. Exceptions: RuntimeError: When deleting a built-in unit group object. |
| findUnit | vcUnit | String name | Finds a unit in unit group by its name.See moreParameters: name (String): Unit's name. Returns: vcUnit: The found unit or None if no unit with the given name exists. |
| getUnitWithMagnitude | vcUnit | Real magnitude | Returns a unit in unit group that best matches given magnitude.See moreParameters: magnitude (Real): Magnitude Exceptions: ValueError: When given magnitude is less or equal to zero. Returns: vcUnit: a unit that best matches given magnitude. |